<?php PageUtil::addVar("stylesheet","<link href=\"".$stylepath."/comment.css\" rel=\"stylesheet\">");?>
<!-- tiny mce -->
<script src="<?php echo base_url('/themes/Theme01/js/tinymce/tinymce.dev.js'); ?>"></script>
<script>
  tinymce.init({
    selector: "textarea#elm1",
    theme: "modern",
    menubar : false,
    plugins: [
      "advlist autolink  image lists charmap print preview hr anchor pagebreak spellchecker",
      "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
      "save table contextmenu directionality emoticons template paste textcolor importcss"
    ],
    external_plugins: {
      //"moxiemanager": "/moxiemanager-php/plugin.js"
    },
    content_css: "css/development.css",
    add_unload_trigger: false,

    toolbar: "insertfile undo redo | bold italic | alignleft aligncenter alignright alignjustify | forecolor fullpage backcolor  preview  ",

    image_advtab: true,

    style_formats: [
      {title: 'Bold text', format: 'h1'},
      {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
      {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
      {title: 'Example 1', inline: 'span', classes: 'example1'},
      {title: 'Example 2', inline: 'span', classes: 'example2'},
      {title: 'Table styles'},
      {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
    ],

    setup: function(ed) {
      /*ed.on(
        'Init PreInit PostRender PreProcess PostProcess BeforeExecCommand ExecCommand Activate Deactivate ' +
        'NodeChange SetAttrib Load Save BeforeSetContent SetContent BeforeGetContent GetContent Remove Show Hide' +
        'Change Undo Redo AddUndo BeforeAddUndo', function(e) {
        console.log(e.type, e);
      });*/
    },

    spellchecker_callback: function(method, words, callback) {
      if (method == "spellcheck") {
        var suggestions = {};

        for (var i = 0; i < words.length; i++) {
          suggestions[words[i]] = ["First", "second"];
        }

        callback(suggestions);
      }
    }
  });
</script>
<!-- -->
<form action="<?php echo base_url('comment/add_comment'); ?>" style ="margin-left:10px;" method="post">
<div class = "commentArea">
<h3>Comment</h3>
</div>
<div class = "first_comment">
		<div class = "top_bar">
			&nbsp;&nbsp;Username :	<?php echo $data[0]['usr_id']; ?>&nbsp;Comment at : <?php echo $data[0]['cr_date'];?>&nbsp;
			Comment No:<?php echo $data[0]['id']; ?>
		</div>
		<div class = "middle_bar">
			<div class = "pic_box">
				<div class = "pic">
					<img src = "<?php echo base_url('themes/Theme01/images/user.png');?>">				
				</div>
			</div>
			<div class = "comment">
				<?php
					$content = wordwrap($data[0]['content'],50,"\n",TRUE);
					echo "$content\n";
				?>
			</div>
		</div>
		<div class = "reply_comment">
			_______________________________________________________________________________________
			<h3>แก้ไขคอมเม้น</h3>
		</div>
		<div class = "user_reply">
			<h4><b><?php echo $userdata['firstname']?></b></h4>
		</div>
		<div class = "box_area">
			<textarea id="elm1" name="content" type="text"> <?php if(!empty($data[0]['content'])) echo$data[0]['content'];  ?></textarea>
				<input type= "hidden" name= "id"  value= "<?php echo $data[0]['id'];?>">
				<input type= "hidden" name= "parent_id"  value= "<?php echo $data[0]['parent_id'];?>">
				<input type= "hidden" name= "pos_id"  value= "<?php echo $data[0]['pos_id'];?>">
				<button type="submit" class="btn btn-primary btn-large" id="submitbtn">Submit</button>
				<button type="reset" class="btn">Cancel</button><br /><br />
		</div>
</div>
</form>
